<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet"
	href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script
	src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ZZTY</title>
<!-- BOOTSTRAP STYLES-->
<link href="../css/bootstrap.css" rel="stylesheet" />

<!-- CUSTOM STYLES-->
<link href="../css/custom.css" rel="stylesheet" />
</head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
<script type="text/javascript">
window.onload = function () {
	  teamHistory();
	  selfHistory();
	}
	
function teamHistory(){
	$.ajax({
		type:"GET",
		url:"../User/ajaxGetTeamHistory",
		success:function(data){
			var res = JSON.parse(data)
			for(var i in res){
				var date = res[i].date;
				var winner1 = res[i].winner1
				var winner2 = res[i].winner2
				if(winner1 != null){	
					if(winner2 !=null ){
					var winner = winner1 + " " +winner2
					}else{
						var winner = winner1
					}
			 	}else{
			 		winner = "";
			 	}
		 		$("#table2").append("<tr><td>"+date+"</td><td>"+winner+"</td></tr>");
		 	}
		},
		error:function(data){
		}
	})
}

function selfHistory(){
	$.ajax({
		type:"GET",
		url:"../User/ajaxGetSelfHistory",
		success:function(data){
			var res = JSON.parse(data)
			for(var i in res){
				var date = res[i].date;
				var winner = res[i].winner
				
				if(winner == null){	
			 		winner = "";
			 	}
		 		$("#table1").append("<tr><td>"+date+"</td><td>"+winner+"</td></tr>");
		 	}
		},
		error:function(data){
		}
	})
}


// 	function getwin() {
// 		window.location.href = 'UserServlet?method=getwinnerid';
// 	}
</script>
<body>
	
	<div id="wrapper">
		<nav class="navbar navbar-default navbar-cls-top " role="navigation"
			style="margin-bottom: 0">
			<div class="navbar-header">
				<a class="navbar-brand">自在天原</a>
			</div>
			<div
				style="color: white;
padding: 15px 50px 5px 50px;
float: right;
font-size: 16px;">
				<form action="../loginOut.jsp" method="post">
					<button type="submit" class="btn btn-danger">注销</button>
				</form>
			</div>
		</nav>
		<!-- /. NAV TOP  -->
		<nav class="navbar-default navbar-side" role="navigation">
			<div class="sidebar-collapse">
				<ul class="nav" id="main-menu">
					<li class="text-center">
						</li>


					<li><a href="../StudentPageSkip/index"><i
							class="fa fa-dashboard fa-3x"></i> 主页</a></li>
					<li><a href="../StudentPageSkip/UserInfo"><i class="fa fa-table fa-3x"></i>
							个人信息</a></li>
					<li><a href="../StudentPageSkip/SelfExam"><i class="fa fa-desktop fa-3x"></i>
							今日竞赛</a></li>
					<li><a href="../StudentPageSkip/TeamExam"><i class="fa fa-qrcode fa-3x"></i>
							今日结对</a></li>
					<li><a href="../StudentPageSkip/History"><i
							class="fa fa-bar-chart-o fa-3x"></i> 历史记录</a></li>

					<li><a href="../StudentPageSkip/ChangePassword"><i
							class="fa fa-edit fa-3x"></i> 密码修改 </a></li>


				</ul>

			</div>

		</nav>
		<!-- /. NAV SIDE  -->
		<div id="page-wrapper">
			<div id="page-inner">
				<div class="row">
					<div class="col-md-12">
						<table class="table">

							<tbody>
								<tr>
									<td><div id="d" align="left" style="margin-top:0px">
											<h1></h1>
										</div></td>
									<td>
										<div id="d" align="right" style="margin-top:0px">
											<iframe id="fancybox-frame"
												name="fancybox-frame1497188085346" frameborder="0"
												scrolling="no" hspace="0"
												src="http://i.tianqi.com/index.php?c=code&a=getcode&id=38&h=60&w=610"></iframe>
										</div>
									</td>

								</tr>

							</tbody>
						</table>
						
						<div class="table-responsive">
							<table class="table table-striped " id="table1" align = "center">
								<tr>
									<th>日期</th>
									<th>竞赛冠军</th>
								</tr>
							</table>
							<table class="table table-striped " id="table2" align = "center">							
								<tr>
									<th>日期</th>
									<th>结对冠军</th>
								</tr>
							</table>
						</div>
						
					</div>
				</div>
				<!-- /. ROW  -->
				<hr />

			</div>
			<!-- /. PAGE INNER  -->
		</div>
		<!-- /. PAGE WRAPPER  -->
	</div>
	<!-- /. WRAPPER  -->
	<!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
	<!-- JQUERY SCRIPTS -->
	<!-- BOOTSTRAP SCRIPTS -->
	<script src="js/bootstrap.min.js"></script>
	<!-- METISMENU SCRIPTS -->
	<script src="js/jquery.metisMenu.js"></script>



</body>
</html>
